package main

import (
"log"
"net"

"golang.org/x/net/context"
"google.golang.org/grpc"
 "git.oschina.net/YPTArch/apigateway/grpc/pb"
"google.golang.org/grpc/reflection"
)

const (
	port = ":8082"
)


type server struct{}


func (s *server) Login(ctx context.Context, in *pb.InData) (*pb.OutData, error) {
	return &pb.OutData{Data: "Hello " + in.Data }, nil
}

func (s *server) LogOut(ctx context.Context, in *pb.InData) (*pb.OutData, error) {
	return &pb.OutData{Data: "Hello " + in.Data }, nil
}

func main() {
	lis, err := net.Listen("tcp", port)
	if err != nil {
		log.Fatalf("failed to listen: %v", err)
	}
	s := grpc.NewServer()
	pb.RegisterGreeterServer(s, &server{})
	// Register reflection service on gRPC server.
	reflection.Register(s)
	if err := s.Serve(lis); err != nil {
		log.Fatalf("failed to serve: %v", err)
	}
}


